$(function() {
    $("#navleft").hover( 
        function(){$(this).addClass("navlefthover");},
        function(){$(this).removeClass("navlefthover");}
        )
    $(".ltitimg").hover( 
        function(){$(this).addClass("hover");},
        function(){$(this).removeClass("hover");
    });
// wide二级导航
    $('.navmain .menu_onelayer li').hover(function(){
        $(this).find("ul").first().show();
    },function(){
        $(this).find("ul").first().hide();
    });


$(".ac-show-userbox").hover(
    function(){
        $(".aw-card-tips").hide();
        var selbuy = $(this).attr('selbuy');
        var cardInfoBox = $(this);
        // 获取用户信息
        if($(this).attr('cardtips')==0){
            $.post(getusercard,{'seller':$(this).attr('seller'),'uid':$(this).attr('uid'),'pid':$(this).attr('pid')},function(data){  //ajax提交到后台排序
                var cardinfo = '';
                if (data.status) {
                        // 卖家信息【
                        var selcard = '';
                        selcard+= '<div id="sel" class="aw-mod" ';
                        if (selbuy!='buy') {
                            selcard+= 'style="display:block;';
                        };
                       
                        selcard+= '"><div class="mod-head">';
                        selcard+='<a target="_blank" class="img" href="'+data.sel.url+'"><img src="'+data.sel.head+'"></a>';
                        selcard+='<p class="title clearfix"><a target="_blank" class="name pull-left" href="'+data.sel.url+'">'+data.sel.name+'</a><i title="" class=" pull-left"></i></p>';
                        selcard+='<p class="aw-user-center-follow-meta"><span>卖家等级: <img src="'+data.sel.leval+'"></span></p>';
                        selcard+='<p class="clearfix"><a style="float: right;" class="aw-card-shield';
                        if (data.sel.black!=0) {
                            selcard+=' on" black="1';
                        }else{
                            selcard+='" black="0';
                        }
                        selcard+='" xid="'+data.sel.uid+'" pilot="sel" href="javascript:void(0);"><span></span>不看他的拍品</a></p>'
                        selcard+='</div><div class="mod-body"><p>'+data.sel.intr+'</p>';
                        selcard+='</div>';
                        selcard+='<div class="mod-footer clearfix">';
                        selcard+='<div class="lybox_min fr clearfix"><a target="_blank" class="ly fl" href="'+data.sel.auctionurl+'"><div class="ico"></div><div class="txt cuit_over">给我留言</div></a></div>';
                        if(data.sel.gzuser==0){
                            selcard+='<div class="gzbox_min ac-attention-box fr clearfix"><a pid="'+data.sel.pid+'" sellerid='+data.sel.uid+' class="gz_sell gz fl selatt'+data.sel.uid+'" st="0" href="javascript:void(0);"><div class="ico"></div><div class="txt cuit_over">关注卖家</div></a></div>';
                        }else{
                            selcard+='<div class="gzbox_min ac-attention-box fr clearfix"><a pid="'+data.sel.pid+'" sellerid='+data.sel.uid+' class="gz_sell gz fl selatt'+data.sel.uid+' on" st="1" href="javascript:void(0);"><div class="ico"></div><div class="txt cuit_over">取消关注</div></a></div>';
                        }
                        selcard+='</div>';
                        selcard+='</div>';
                        // 卖家信息】
                        // 买家信息【
                        var buycard = '';
                        buycard+= '<div id="buy" class="aw-mod" ';
                        if (selbuy=='buy') {
                            buycard+= 'style="display:block;';
                        };           
                        buycard+= '"><div class="mod-head">';
                        buycard+='<a target="_blank" class="img" href="'+data.buy.url+'"><img src="'+data.buy.head+'"></a>';
                        buycard+='<p class="title clearfix"><a target="_blank" class="name pull-left" href="'+data.buy.url+'">'+data.buy.name+'</a><i title="" class=" pull-left"></i></p>';
                        buycard+='<p class="aw-user-center-follow-meta"><span>买家等级: <img src="'+data.buy.leval+'"></span></p>';
                        buycard+='<p class="clearfix"><a style="float: right;" class="aw-card-shield';
                        if (data.buy.black!=0) {
                            buycard+=' on" black="1';
                        }else{
                            buycard+='" black="0';
                        }
                        buycard+='" xid="'+data.buy.uid+'" pilot="buy" href="javascript:void(0);"><span></span>不让他看拍品</a></p>';
                        buycard+='</div><div class="mod-body"><p>'+data.buy.intr+'</p>';
                        buycard+='</div>';
                        // 买家信息】

                    cardinfo+= '<div class="aw-card-tips">';
                    // C2C运营
                    if (isbc!=1) {
                        cardinfo+= '<ul class="aw-card-menu lstit clearfix">';
                        if (selbuy!='buy') {
                            cardinfo+= '<li  class="selected">卖家信息</li><li>买家信息</li>';
                        }else{
                            cardinfo+= '<li>卖家信息</li><li class="selected">买家信息</li>';
                        }
                        cardinfo+= '</ul>';
                        cardinfo+= '<div class="aw-card-con">';
                        cardinfo+=selcard;
                        cardinfo+=buycard;
                    }else{
                    // B2C运营
                        if (selbuy!='buy') {
                            cardinfo +=selcard;
                        }else{
                            cardinfo +=buycard;
                        }
                    }
                    cardinfo+='</div></div>';
                    cardInfoBox.append(cardinfo);
                } else {
                    popup.error(data.msg);
                    setTimeout(function(){
                        popup.close("asyncbox_success");
                    },2000);
                }
            },'json');
            $(this).attr('cardtips',1);
            $(this).children(".aw-card-tips").show();
        }else{
            $(this).children(".aw-card-tips").show();
        }
    },
    function(){
        $(this).children(".aw-card-tips").hide();
    }
);




// 回到顶部【
$(window).scroll(function(){
    if ($(window).scrollTop()>100){
        $("#returnTop").show();
    }else{
        $("#returnTop").hide();
    }
});
$("#returnTop").click(function () {
    var speed=200;//滑动的速度
    $('body,html').animate({ scrollTop: 0 }, speed);
    return false;
 });
// 回到顶部】
$('#tab_menu').on('click','li',function(){
      $(this).addClass("selected").siblings().removeClass("selected");
      var div_index = $(this).index();

      $("#tab_box>div").eq(div_index).show().siblings().hide();

}).hover(function(){
      $(this).addClass("hover");
},function(){
      $(this).removeClass("hover");
});
// 用户标签内选项卡操作
$(document).on('click','.aw-card-menu li',function(){
      $(this).addClass("selected").siblings().removeClass("selected");
      var card_con_index = $(this).index();
      $(this).parents('.aw-card-tips').children('.aw-card-con').find('.aw-mod').eq(card_con_index).show().siblings().hide();
      // $(".aw-card-con>div")
});

// 不让对方看
$(document).on('click','.aw-card-shield',function(){
    if(login == 1){
        var thsck = $(this);
        var pilot = $(this).attr('pilot');
        var black = $(this).attr('black');
        var xid = $(this).attr('xid');
        $.post(blacklistUrl,{'xid':xid,'pilot':pilot,'black':black},function(data){
            if (data.status) {
                if (data.black==1) {
                    thsck.addClass('on');
                }else{
                    thsck.removeClass('on');
                }
                thsck.attr('black',data.black);
                popStatus(1, data.msg, 2,'',true);
            } else {
                popStatus(2, data.msg, 2,'',true);
            }
        },'json');
    }else{
        popStatus(2, '您没有登陆！请登录...', 2,'',true);
    }
});

// 选项卡操作
    var $tabs = $(".tab_menu a");
    $tabs.bind("click", function(){
        var tabId = $(this).attr("href");
        var tabIdStr = tabId.split("#");
        var currentTabId = '#'+tabIdStr[1];
        $(currentTabId).show().siblings(".tab_con").hide();
        $(this).parent("li").addClass("on").siblings().removeClass("on");
        return false;
    })
    .focus(function(){
        $(this).blur();
    });
//用户关注拍品
    $('.auctionbox').on('mouseenter','.att',function(){
        if($(this).attr('yn')=='y'){
            $(this).html('取消');
        }
    });
    $('.auctionbox').on('mouseout','.att',function(){
        if($(this).attr('yn')=='y'){
            $(this).html('已关注');
        }
    });
    $('.auctionbox ').on("click",".att",function(){
        if(login == 1){
            var thisObj = $(this);
            var gid = $(this).attr('pid');
            var rela = $(this).attr('rela');
            var yn = $(this).attr('yn');
            $.post(attUrl,{'gid':gid , 'rela':rela, 'yn':yn},function(data){
                if (data.status) {
                    if(yn =='n'){
                        thisObj.addClass('on');
                        thisObj.html('已关注');
                        thisObj.attr('yn','y');
                    }else if(yn =='y'){
                        thisObj.removeClass('on');
                        thisObj.html('关注');
                        thisObj.attr('yn','n');
                    }
                } else {
                    popStatus(2, data.msg, 2,'',true);
                }
            },'json');  
            
        }else{
            popup.alert('<div class="sayOnelin">您没有登录！请登录</div>');
        }
    });
// 关注卖家操作【
    $('body').on('mouseenter','.gz_sell',function(){
        if($(this).attr('st')=='1'){
            $(this).children('.txt').html('取消关注');
        }
    });
    $('body').on('mouseout','.gz_sell',function(){
        if($(this).attr('st')=='1'){
            $(this).children('.txt').html('已关注');
        }
    });
    if($('.gz_sell').attr('st')==1){
        $('.gz_sell').addClass('on');
    }
    $('body').on('click','.gz_sell',function(){
        var thisbj=$(this);
        var st = $(this).attr('st');
        var attsellerid =  $(this).attr('sellerid');
        var thisall =  $('.gz_sell.selatt'+attsellerid);
        $.post(setAttentionSellerUrl,{'sellerid':attsellerid,'st':st},function(data){
            if (data.status) {
                if(st==0){
                    thisall.children('.txt').html('已关注');
                    thisall.attr('st',1);
                    popStatus(1, data.msg, 1,'',true);
                    thisall.addClass('on');
                    setTimeout(function(){
                        popup.close("asyncbox_success");
                    },2000);
                }else{
                    thisall.children('.txt').html('关注卖家');
                    thisall.attr('st',0);
                    popStatus(1, data.msg, 1,'',true);
                    thisall.removeClass('on');
                }
                
            } else {
                popStatus(2, data.msg, 2,'',true);
            }
        },'json');
    });
// 关注卖家操作】
    if ((myBrowser() == "IE55")||(myBrowser() == "IE6")||(myBrowser() == "IE7")||(myBrowser() == "IE8")) {
        asyncbox.open({id : 'iealert',url : iealertUrl,title : '温馨提示',scroll:false,drag : false,modal : true});
    }
});
// 判断浏览器类型【
function myBrowser(){
    var userAgent = window.navigator.userAgent; //取得浏览器的userAgent字符串
    var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
    var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
    var isSafari = userAgent.indexOf("Safari") > -1; //判断是否Safari浏览器
    var isChrome = userAgent.indexOf("Chrome") >= 0;
    if (isIE) {
        var IE5 = IE55 = IE6 = IE7 = IE8 = false;
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var fIEVersion = parseFloat(RegExp["$1"]);
        IE55 = fIEVersion == 5.5;
        IE6 = fIEVersion == 6.0;
        IE7 = fIEVersion == 7.0;
        IE8 = fIEVersion == 8.0;
        if (IE55) {
            return "IE55";
        }
        if (IE6) {
            return "IE6";
        }
        if (IE7) {
            return "IE7";
        }
        if (IE8) {
            return "IE8";
        }
    }//isIE end
    if (isFF) {
        return "FF";
    }
    if (isOpera) {
        return "Opera";
    }
    if (isChrome) {
        return "Chrome";
    }
}//myBrowser() end



// 判断浏览器类型】










	
	
	
	
	